from langchain_community.docstore import InMemoryDocstore
from langchain_community.vectorstores import FAISS
from langchain_core.documents import Document

from embedding_demo.embeddingDemo03Qwen3 import CustomQwen3Embeddings
import faiss
qwen_embedding = CustomQwen3Embeddings("Qwen/Qwen3-Embedding-0.6B")

# 从本地文件加载数据库
vector_store = FAISS.load_local(folder_path='../faiss_db',embeddings=qwen_embedding,allow_dangerous_deserialization=True)


results = vector_store.similarity_search_with_score(query='我今天吃了什么',k=2, filter={'source': 'tweet'})

for res,score in results:
    print(res,score)

